 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
|
Classes
should always contain two functions:
|
 |
|
|
|
the constructor
and destructor.
|
|
|
|
Syntax:
|
|
 |
|
|
|
|
|
|
n |
the class name
denotes a constructor
|
|
|
|
n |
a ~ before the
class name is a destructor
|
|
|
|
The
basic idea is
|
|
 |
|
|
|
|
|
|
n |
to have the
constructor initialises variables
|
|
|
|
n |
to have the
destructor clean up after the class,
|
|
|
which includes
freeing any memory allocated
|
|